import {createApp} from 'vue'
import App from './App.vue'
import {router} from './router/index'

import Vant from 'vant';
import 'vant/lib/index.css';
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'

router.beforeEach((to, from, next) => {
    let white = ['/login','/com']
    if(white.indexOf(to.path)>=0){
        next()
    }else {
        //获取该用户资源表
        let pagelist = localStorage.getItem('url_list')
        if(JSON.parse(pagelist)){
            let reslist = JSON.parse(pagelist)
            if(reslist.indexOf(to.path)>=0){
                next()
            }else {
                alert('您无权访问')
                return from;
            }
        }
    }
})
const app = createApp(App)

app.use(router);
app.use(Vant);
app.mount('#app')
app.use(ElementPlus)